using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace DCEdu
{
public class Feedback
{ 
	private int iD;
	public int ID
	{
		get { return iD;}
		set { iD = value;}
	}

	private int cusID;
	public int CusID
	{
		get { return cusID;}
		set { cusID = value;}
	}

	private int tutorID;
	public int TutorID
	{
		get { return tutorID;}
		set { tutorID = value;}
	}

	private int contractID;
	public int ContractID
	{
		get { return contractID;}
		set { contractID = value;}
	}

	private String type;
	public String Type
	{
		get { return type;}
		set { type = value;}
	}

	private DateTime date;
	public DateTime Date
	{
		get { return date;}
		set { date = value;}
	}

	private String content;
	public String Content
	{
		get { return content;}
		set { content = value;}
	}

	private String rate;
	public String Rate
	{
		get { return rate;}
		set { rate = value;}
	}

	public Feedback() {}

	public Feedback(int iD, int cusID, int tutorID, int contractID, String type, DateTime date, String content, String rate)
	 {
		this.iD = iD;
 		this.cusID = cusID;
 		this.tutorID = tutorID;
 		this.contractID = contractID;
 		this.type = type;
 		this.date = date;
 		this.content = content;
 		this.rate = rate;
 	}

	public int Add(int cusID, int tutorID, int contractID, String type, DateTime date, String content, String rate)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"Feedback_Add",cusID,tutorID,contractID,type,date,content,rate);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int iD, int cusID, int tutorID, int contractID, String type, DateTime date, String content, String rate)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"Feedback_Update",iD,cusID,tutorID,contractID,type,date,content,rate);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int iD)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"Feedback_Delete",iD);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"Feedback_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int iD)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"Feedback_Get",iD);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"Feedback_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
